<?php
 Session_Start () ;
 Include ("../../include/garennes.cfg") ;
 Include ("../../include/init.php") ;
 Include ("../include/config.inc") ;
 verif_droits ($droit_courant, $_SESSION ["code"]) ;
 
 $param = var_courante ("param", 0, null) ;
 $num_theme = var_courante ("num_theme", 0, 1) ;
 
 $param_theme = parametres_theme (themeparsession ($_SESSION ["code"])) ;
 $rep_themes = "../../images/themes/" ;
 Include ($rep_themes.$param_theme ["nom_repertoire"]."/".$param_theme ["fichier_config"]) ;
 
 If (IsSet ($param))
  {
   If ($param == 1)
    {
     $ok = SQL_commande ("UPDATE utilisateurs SET theme='".$num_theme."' WHERE id_utilisateur='".utilparcode ($_SESSION ["code"])."'", $id_sql) ;
     $ok = SQL_commande ("UPDATE sessions SET theme='".$num_theme."' WHERE id_session='".$_SESSION ["code"]."'", $id_sql) ;
     Header ("Location: ../index.php?param=1") ;
     Exit ;
    }
  }

 Include ("../../images/themes/config.inc") ;

 Echo "<HTML><HEAD>" ;
 entete_html ("Garennes", "_top", 1) ;
 Echo styles ("none", "none", "none", $theme [0][32], "none") ;
 Include ("./theme_affichage.js") ;
 Echo "</HEAD>" ;
 
 Echo "<BODY BACKGROUND=\"".$rep_themes.$param_theme ["nom_repertoire"]."/".$theme [9][10]."\" TEXT=\"".$theme [0][4]."\" onContextMenu=\"return false\">" ;
 Echo "<TABLE BORDER=\"0\" WIDTH=\"100%\">" ;
 Echo "<TR>" ;
 //Echo "<TD>&nbsp;</TD>" ;
 Echo "<TD ALIGN=\"CENTER\"><FONT SIZE=\"+1\">Th&egrave;mes d'affichage</FONT></FONT></TD>" ;
 //Echo "<TD ALIGN=\"RIGHT\"><A HREF=\"javascript:ouvrefenetre('./aide.php?aide=3&rep=".$_SESSION ["repertoire_config"]."',350,650);\"><IMG SRC=\"../images/aide.png\" BORDER=\"0\"></A></TD>" ;
 Echo "</TR>" ;
 If (IsSet ($mess) And ($mess == 1))
  {
   Echo "<TR>" ;
   Echo "<TD ALIGN=\"CENTER\" COLSPAN=\"3\"><BLINK><FONT SIZE=\"+1\" COLOR=\"#FF0000\">Modification effectu&eacute;e !</FONT></BLINK></TD>" ;
   Echo "</TR>" ;
  }
 If ($theme [2][1] == 0)
  {
   Echo "<TR>" ;
   Echo "<TD ALIGN=\"CENTER\" COLSPAN=\"3\"><FONT SIZE=\"+1\">Choisissez&nbsp;un&nbsp;th&egrave;me&nbsp;pour&nbsp;l'affichage.</FONT></FONT></TD>" ;
   Echo "</TR>" ;
  }
 Else
  {
   $titre_fenetre = "Choisissez&nbsp;un&nbsp;th&egrave;me&nbsp;pour&nbsp;l'affichage." ;
  }
 Echo "</TABLE>" ;
 Echo "<FORM ACTION=\"./theme_affichage.php\" NAME=\"fparam\" METHOD=\"POST\">" ;
 Echo "<INPUT TYPE=\"HIDDEN\" NAME=\"param\" VALUE=\"1\">" ;

 $non_centrer = 0 ;
 Include ("../include/debut_theme.inc") ;
 
 Echo "<TABLE BORDER=\"0\" BGCOLOR=\"".$theme [0][3]."\" ALIGN=\"CENTER\" CELLSPACING=\"0\" CELLPADDING=\"0\" STYLE=\"border-collapse:collapse\">" ;
 Echo "<TR><TD>" ;
 Echo "<TABLE BORDER=\"0\" vALIGN=\"TOP\" CELLSPACING=\"0\" CELLPADDING=\"0\" STYLE=\"border-collapse:collapse\">" ;
 Echo "<TR>" ;
 Echo "<TD ALIGN=\"CENTER\"></TD>" ; //<FONT COLOR=\"".$theme [0][4]."\">&nbsp;Th&egrave;mes&nbsp;disponibles&nbsp;</FONT></TD>" ;
 Echo "<TD ALIGN=\"CENTER\"><FONT COLOR=\"".$theme [0][4]."\">&nbsp;Aper&ccedil;u&nbsp;</FONT></TD>" ;
 Echo "<TD ROWSPAN=\"2\">&nbsp;</TD>" ;
 Echo "</TR>" ;
 Echo "<TR><TD vALIGN=\"TOP\">" ;
 Echo "<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" STYLE=\"border-collapse:collapse\">" ;
 Echo "<TR><TD>&nbsp;</TD></TR>" ;
 $num = themeparsession ($_SESSION ["code"]) ;
 If (!$num) { $num = 1 ; }
 For ($t = 1 ; $t <= $themes [0][0] ; $t++)
  {
   Include ($rep_themes.$themes [$t][1]."/".$themes [$t][2]) ;
   Echo "<TR><TD>" ;
   Echo "<A HREF=\"javascript:coche(document.fparam.num_theme,".($t-1).",".$t.",'".$rep_themes.$themes [$t][1]."/photo_ecran.png')\"" ;
   Echo " onmouseover=\"javascript:affiche('".$rep_themes.$themes [$t][1]."/photo_ecran.png')\"" ;
   Echo " onmouseout=\"javascript:affiche_old()\"" ;
   Echo " onclick=\"javascript:coche(document.fparam.num_theme,".($t-1).",".$t.",'".$rep_themes.$themes [$t][1]."/photo_ecran.png')\">&nbsp;" ;
   Echo "<INPUT TYPE=\"RADIO\" NAME=\"num_theme\" VALUE=\"".$t."\"" ;
   If ($num == $t) { Echo " CHECKED" ; }
   Echo ">&nbsp;".$themes [$t][0]."&nbsp;</A></TD></TR>" ;
   If ($num == $t) { Echo "<SCRIPT> image_old = '".$rep_themes.$themes [$t][1]."/photo_ecran.png' </SCRIPT>" ; }
  }
 
 Echo "</TABLE>" ;
 Echo "</TD>" ;
 // MISE EN PLACE DU THEME
 Echo "<TD VALIGN=\"MIDDLE\"><IMG SRC=\"".$rep_themes.$themes [$num][1]."/photo_ecran.png\" BORDER=\"0\" NAME=\"photo_ecran\"></TD>" ;
 Echo "</TR></TABLE></TD>" ;
 Echo "<TD>" ;
 Echo "<TR><TD COLSPAN=\"3\">&nbsp;</TD></TR>" ;
 Echo "<TR><TD COLSPAN=\"3\" ALIGN=\"CENTER\"><INPUT TYPE=\"IMAGE\" SRC=\"".$rep_themes.$themes [$num][1]."/valider.png\" VALUE=\"  VALIDER  \" NAME=\"submit\"></TD></TR>" ;
 Echo "</TABLE>" ;
 
 Include ("../include/fin_theme.inc") ;
 
 Echo "</FORM></BODY></HTML>" ;
?>